/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jeeobserver.server;

import java.io.Serializable;
import java.util.Date;

public abstract class ActionParameters implements Serializable, RequestParameter {

	 private final Integer elementId;

	 private final String context;

	 private final Integer category;

	 private final String project;

	 private final String element;

	 ActionParameters(Integer category, Integer elementId, String context, String project, String element) {
			this.category = category;

			this.elementId = elementId;

			this.context = context;
			this.project = project;
			this.element = element;
	 }

	 public Integer getElementId() {
			return elementId;
	 }

	 public String getContext() {
			return context;
	 }

	 public Integer getCategory() {
			return category;
	 }

	 public String getProject() {
			return project;
	 }

	 public String getElement() {
			return element;
	 }

	 public static abstract class StatisticsParameter extends ActionParameters {

			private final Date dateFrom;

			private final Date dateTo;

			StatisticsParameter(Integer category, Integer elementId, String context, String project, String element, Date dateFrom, Date dateTo) {
				 super(category, elementId, context, project, element);
				 this.dateFrom = dateFrom;
				 this.dateTo = dateTo;
			}

			public Date getDateFrom() {
				 return dateFrom;
			}

			public Date getDateTo() {
				 return dateTo;
			}
	 }

	 public static class DeleteStatisticsParameter extends ActionParameters.StatisticsParameter {

			private static final long serialVersionUID = 40L;

			public DeleteStatisticsParameter(Date dateFrom, Date dateTo) {
				 super(null, null, null, null, null, dateFrom, dateTo);
			}

			public DeleteStatisticsParameter(Integer category, String context, String project, String name, Date dateFrom, Date dateTo) {
				 super(category, null, context, project, name, dateFrom, dateTo);
			}

			public DeleteStatisticsParameter(Integer elementId, Date dateFrom, Date dateTo) {
				 super(null, elementId, null, null, null, dateFrom, dateTo);
			}
	 }

	 public static class SearchStatisticsParameter extends ActionParameters.StatisticsParameter {

			private static final long serialVersionUID = 40L;

			/** The sampling period. */
			private final int samplingPeriod;

			/** The group by. */
			private final int groupBy;

			public SearchStatisticsParameter(Integer elementId, Date dateFrom, Date dateTo, int groupBy, int samplingPeriod) {
				 super(null, elementId, null, null, null, dateFrom, dateTo);
				 this.groupBy = groupBy;
				 this.samplingPeriod = samplingPeriod;
			}

			public SearchStatisticsParameter(Integer category, String context, String project, String name, Date dateFrom, Date dateTo, int groupBy, int samplingPeriod) {
				 super(category, null, context, project, name, dateFrom, dateTo);
				 this.groupBy = groupBy;
				 this.samplingPeriod = samplingPeriod;
			}

			public int getSamplingPeriod() {
				 return samplingPeriod;
			}

			public int getGroupBy() {
				 return groupBy;
			}
	 }

	 public static class SearchElementsParameter extends ActionParameters {

			private static final long serialVersionUID = 40L;

			public SearchElementsParameter(Integer category, Integer elementId, String context, String project, String name) {
				 super(category, elementId, context, project, name);
			}

			public SearchElementsParameter(Integer category, String context, String project, String name) {
				 super(category, null, context, project, name);
			}

			public SearchElementsParameter(Integer category, Integer elementId) {
				 super(category, elementId, null, null, null);
			}
	 }
}
